 // -------------------------------------------------------------------------------------------------------------------
//
//  File: MainWindow.h
//
//  Copyright 2016 (c) Decawave Ltd, Dublin, Ireland.
//
//  All rights reserved.
//
//  Author:
//
// -------------------------------------------------------------------------------------------------------------------

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QAbstractSocket>
#include <QLabel>

#include <QTranslator>
#include <QLocale>


#include "speedmonitorWidget.h"
#include "slamwidget.h"

#include <QStatusBar>
#include <QAction>
#include <QMenu>
#include <QMenuBar>
#include <QStackedWidget>
#include <QListWidget>
#include"titlebar.h"
#include "ladarwidget.h"
#include "pointcloudwidget.h"
#include "movecontrolwidget.h"
#include "uwbwidget.h"
#include "pathplanwidget.h"
#include "pathfollowwidget.h"
#include "settingwidget.h"
#include "gridmap.h"
#include "node/rosthread.h"

extern bool language;
extern bool startCalibration;
extern QString BTN_sendSocketText;
extern QString LE_ip_addressText;
extern QString ip_addressText;
extern int LE_comTexttoInt;

class MainWindow : public QWidget
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();


    SLAMwidget *pathWidget();


    void createConnect();
    bool event(QEvent *event);//语言切换响应事件



public slots:
    void SetLanguage_cn();
    void SetLanguage_en();
    void ShowTcp485Addr();
    void onShowMenu();

    void onReady();

    void onAboutAction();

    void statusBarMessage(QString status);
    void statusBarMessage(QtMsgType type,QString status);

    void onBtnSettingClick();

private:
    void initUI();
    void InitRight();
    void InitLeft();
    void setMenu();
    void setStackWidget();
    void startRosCore();
    void checkRosCore();

private:

    QMenu *_helpMenu;
    QAction *_aboutAction;

    SpeedMonitorWidget *_speedMonitorDlg;
    SLAMwidget *_SLAMWidget;

    QTranslator translator;
    QLocale locale;

private:

    TitleBar *titleWidget;//标题栏
    QStackedWidget *stackWidget;
    QListWidget *m_listWidget;
    QWidget *m_leftWidget;
    QPushButton *m_btnSetting;

    QAction *actionAbout;


    QAction *action_cn;
    QAction *action_en;
    QAction *action_tcp_485;



    QMenu *menu;
    QLabel *tips;



    QWidget *m_right;
    LadarWidget *m_ladarWidget;
    PointCloudWidget *m_pointcloudwidget;
    MoveControlWidget *m_moveControlW;
    UWBWidget* m_uwbW;
    PathPlanWidget* m_pathPlanW;
    PathFollowWidget* m_pathFollowW;
    GridMapWidget* m_gridMapW;
    SettingWidget* m_settingW;

    RosThread *m_rosThread;

    int m_preListIndex;
};

#endif // MAINWINDOW_H
